﻿using PrintLabel.Tools;
using SqlSugar.Extensions;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using 纺织贸易管理系统;

namespace PrintLabel.View
{
    public partial class InputDefect : Sunny.UI.UIForm
    {
        /// <summary>
        /// 疵点
        /// </summary>
        public ChiDianTable Defect { get; set; }
        public InputDefect()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Defect = null;
            this.Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if( label2.Text =="0")
            {
                ShowMessage.ShowErrorMessagebox(this, "请选择一下扣分值");
                return;
            }
            if (Defect != null)
            {
                Defect.KouFeng = label2.Text.ObjToDecimal();
                Defect.EdgeDistance = uiNumPadTextBox1.Text.ObjToDecimal();
                Defect.IsALL = checkbox1.Checked ? "通匹" : string.Empty;
            }
            this.Close();
        }

        private void uiNumPadTextBox1_MouseClick(object sender, MouseEventArgs e)
        {
         
        }

        private void InputDefect_Load(object sender, EventArgs e)
        {
            label2.Text = Defect.KouFeng.ToString();
            uiNumPadTextBox1.Text = Defect.EdgeDistance.ToString();
            checkbox1.Checked = Defect.IsALL == "通匹";
        }

        private void button3_Click(object sender, EventArgs e)
        {
            var btn = sender as AntdUI.Button;
            label2.Text = btn.Text;
        }
    }
}
